\(\int x^2 \cot (a+i \log (x)) \, dx\) [187]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 43 \[ \int x^2 \cot (a+i \log (x)) \, dx=-2 i e^{2 i a} x-\frac {i x^3}{3}+2 i e^{3 i a} \text {arctanh}\left (e^{-i a} x\right ) \]

[Out]

-2*I*exp(2*I*a)*x-1/3*I*x^3+2*I*exp(3*I*a)*arctanh(x/exp(I*a))

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {4592, 456, 470, 327, 213} \[ \int x^2 \cot (a+i \log (x)) \, dx=2 i e^{3 i a} \text {arctanh}\left (e^{-i a} x\right )-2 i e^{2 i a} x-\frac {i x^3}{3} \]

[In]

Int[x^2*Cot[a + I*Log[x]],x]

[Out]

(-2*I)*E^((2*I)*a)*x - (I/3)*x^3 + (2*I)*E^((3*I)*a)*ArcTanh[x/E^(I*a)]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 470

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p + 1) + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m +
 n*(p + 1) + 1)), Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c - a*d, 0]
 && NeQ[m + n*(p + 1) + 1, 0]

Rule 4592

Int[Cot[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*((-I - I*E^(2*I*a*d)
*x^(2*I*b*d))/(1 - E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\left (-i-\frac {i e^{2 i a}}{x^2}\right ) x^2}{1-\frac {e^{2 i a}}{x^2}} \, dx \\ & = \int \frac {x^2 \left (-i e^{2 i a}-i x^2\right )}{-e^{2 i a}+x^2} \, dx \\ & = -\frac {i x^3}{3}-\left (2 i e^{2 i a}\right ) \int \frac {x^2}{-e^{2 i a}+x^2} \, dx \\ & = -2 i e^{2 i a} x-\frac {i x^3}{3}-\left (2 i e^{4 i a}\right ) \int \frac {1}{-e^{2 i a}+x^2} \, dx \\ & = -2 i e^{2 i a} x-\frac {i x^3}{3}+2 i e^{3 i a} \text {arctanh}\left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.53 \[ \int x^2 \cot (a+i \log (x)) \, dx=-\frac {i x^3}{3}-2 i x \cos (2 a)+2 i \text {arctanh}(x \cos (a)-i x \sin (a)) \cos (3 a)+2 x \sin (2 a)-2 \text {arctanh}(x \cos (a)-i x \sin (a)) \sin (3 a) \]

[In]

Integrate[x^2*Cot[a + I*Log[x]],x]

[Out]

(-1/3*I)*x^3 - (2*I)*x*Cos[2*a] + (2*I)*ArcTanh[x*Cos[a] - I*x*Sin[a]]*Cos[3*a] + 2*x*Sin[2*a] - 2*ArcTanh[x*C
os[a] - I*x*Sin[a]]*Sin[3*a]

Maple [A] (verified)

Time = 0.47 (sec) , antiderivative size = 33, normalized size of antiderivative = 0.77

method result size
risch \(-\frac {i x^{3}}{3}-2 i {\mathrm e}^{2 i a} x +2 i \operatorname {arctanh}\left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{3 i a}\) \(33\)

[In]

int(x^2*cot(a+I*ln(x)),x,method=_RETURNVERBOSE)

[Out]

-1/3*I*x^3-2*I*exp(2*I*a)*x+2*I*arctanh(x*exp(-I*a))*exp(3*I*a)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (26) = 52\).

Time = 0.24 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.81 \[ \int x^2 \cot (a+i \log (x)) \, dx=-\frac {1}{3} i \, x^{3} - 2 i \, x e^{\left (2 i \, a\right )} - \sqrt {-e^{\left (6 i \, a\right )}} \log \left ({\left (x e^{\left (2 i \, a\right )} + i \, \sqrt {-e^{\left (6 i \, a\right )}}\right )} e^{\left (-2 i \, a\right )}\right ) + \sqrt {-e^{\left (6 i \, a\right )}} \log \left ({\left (x e^{\left (2 i \, a\right )} - i \, \sqrt {-e^{\left (6 i \, a\right )}}\right )} e^{\left (-2 i \, a\right )}\right ) \]

[In]

integrate(x^2*cot(a+I*log(x)),x, algorithm="fricas")

[Out]

-1/3*I*x^3 - 2*I*x*e^(2*I*a) - sqrt(-e^(6*I*a))*log((x*e^(2*I*a) + I*sqrt(-e^(6*I*a)))*e^(-2*I*a)) + sqrt(-e^(
6*I*a))*log((x*e^(2*I*a) - I*sqrt(-e^(6*I*a)))*e^(-2*I*a))

Sympy [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.47 \[ \int x^2 \cot (a+i \log (x)) \, dx=- \frac {i x^{3}}{3} - 2 i x e^{2 i a} - \left (i \log {\left (x e^{2 i a} - e^{3 i a} \right )} - i \log {\left (x e^{2 i a} + e^{3 i a} \right )}\right ) e^{3 i a} \]

[In]

integrate(x**2*cot(a+I*ln(x)),x)

[Out]

-I*x**3/3 - 2*I*x*exp(2*I*a) - (I*log(x*exp(2*I*a) - exp(3*I*a)) - I*log(x*exp(2*I*a) + exp(3*I*a)))*exp(3*I*a
)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 126 vs. \(2 (26) = 52\).

Time = 0.22 (sec) , antiderivative size = 126, normalized size of antiderivative = 2.93 \[ \int x^2 \cot (a+i \log (x)) \, dx=-\frac {1}{3} i \, x^{3} + 2 \, x {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} - {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) - {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right ) + \frac {1}{2} \, {\left (i \, \cos \left (3 \, a\right ) - \sin \left (3 \, a\right )\right )} \log \left (x^{2} + 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) + \frac {1}{2} \, {\left (-i \, \cos \left (3 \, a\right ) + \sin \left (3 \, a\right )\right )} \log \left (x^{2} - 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) \]

[In]

integrate(x^2*cot(a+I*log(x)),x, algorithm="maxima")

[Out]

-1/3*I*x^3 + 2*x*(-I*cos(2*a) + sin(2*a)) - (cos(3*a) + I*sin(3*a))*arctan2(sin(a), x + cos(a)) - (cos(3*a) +
I*sin(3*a))*arctan2(sin(a), x - cos(a)) + 1/2*(I*cos(3*a) - sin(3*a))*log(x^2 + 2*x*cos(a) + cos(a)^2 + sin(a)
^2) + 1/2*(-I*cos(3*a) + sin(3*a))*log(x^2 - 2*x*cos(a) + cos(a)^2 + sin(a)^2)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.95 \[ \int x^2 \cot (a+i \log (x)) \, dx=-\frac {1}{3} i \, x^{3} - 2 i \, x e^{\left (2 i \, a\right )} + i \, e^{\left (3 i \, a\right )} \log \left (x + e^{\left (i \, a\right )}\right ) - i \, e^{\left (3 i \, a\right )} \log \left (-x + e^{\left (i \, a\right )}\right ) \]

[In]

integrate(x^2*cot(a+I*log(x)),x, algorithm="giac")

[Out]

-1/3*I*x^3 - 2*I*x*e^(2*I*a) + I*e^(3*I*a)*log(x + e^(I*a)) - I*e^(3*I*a)*log(-x + e^(I*a))

Mupad [B] (verification not implemented)

Time = 27.49 (sec) , antiderivative size = 40, normalized size of antiderivative = 0.93 \[ \int x^2 \cot (a+i \log (x)) \, dx=-\mathrm {atan}\left (\frac {x}{\sqrt {-{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,{\left (-{\mathrm {e}}^{a\,2{}\mathrm {i}}\right )}^{3/2}\,2{}\mathrm {i}-\frac {x^3\,1{}\mathrm {i}}{3}-x\,{\mathrm {e}}^{a\,2{}\mathrm {i}}\,2{}\mathrm {i} \]

[In]

int(x^2*cot(a + log(x)*1i),x)

[Out]

- atan(x/(-exp(a*2i))^(1/2))*(-exp(a*2i))^(3/2)*2i - (x^3*1i)/3 - x*exp(a*2i)*2i